package fy.EAM.operator;

import com.seeyon.v3x.services.flow.bean.FlowExport;
import com.seeyon.v3x.services.form.bean.ValueExport;

import fy.EAM.bean.Transferbean;
import fy.EAM.dao.transferdao;
import fy.form.listen.operate.AForm_Save_Operator;
import fy.form.listen.operate.IFormOperator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class transferoperator extends AForm_Save_Operator implements IFormOperator{
	private Transferbean bean=new Transferbean();
	private static Log log = LogFactory.getLog(transferdao.class);
	@Override
	public String getFormName() {
		// TODO Auto-generated method stub
		return "EAM移交数据写入";
	}

	@Override
	protected void parseOtherField_FirstStep(FlowExport flowExport) {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void parseValueExport(ValueExport ve) {
		// TODO Auto-generated method stub
		String fieldName = ve.getDisplayName();
		log.info("fieldName = "+fieldName+"ve.getValue()="+ve.getValue());
		if ("资产编号".equals(fieldName)) {
			bean.setAssetNumber(ve.getValue());
		} else if ("序列号".equals(fieldName)) {
			bean.setSerialNumber(ve.getValue());
		}else if ("单据编号".equals(fieldName)) {
			bean.setOABillNum(ve.getValue());
		}else if ("接收人".equals(fieldName)) {
			bean.setUserName(ve.getValue());
		}else if ("接收人登录名1".equals(fieldName)) {
			bean.setJobNum(ve.getValue());
		}else if ("移交人".equals(fieldName)) {
			bean.setHandoverPerson(ve.getValue());
		}else if ("移交日期".equals(fieldName)) {
			bean.setHandoverTime(ve.getValue());
		}else if ("接收单位".equals(fieldName)) {
			bean.setHandoverCpt(ve.getValue());
		}else if ("财务移交确认".equals(fieldName)) {
			bean.setIsFT(ve.getValue());
		}else if ("接收部门".equals(fieldName)) {
			bean.setWorkCenterName(ve.getValue());
		}
	}
	
	@Override
	protected boolean save() {
		log.info("transfer ---- >> save");
		// TODO Auto-generated method stub
		try {
			transferdao dao=new transferdao();
			dao.setTransferbean(bean);
			return dao.Transfer();
		} catch (Exception e) {
			// TODO: handle exception
		}
		return false;
	}

}
